﻿using System;

namespace DMS.Dal
{
    public static class DatabaseOptionExtension
    {
        public static string GetName(this DatabaseNode databaseNode)
        {
            switch (databaseNode)
            {
                case DatabaseNode.Default:
                    return "name=DMSContext";
                case DatabaseNode.BOReadOnly:
                    return "name=LiuloBOReadOnlyContext";
                case DatabaseNode.FOReadOnly:
                    return "name=LiuloFOReadOnlyContext";
            }

            return string.Empty;
        }

        public static string GetName(this DatabaseNode databaseNode, Type contextType)
        {
            if (contextType == typeof(DMSContext))
                return databaseNode.GetName(contextType);

            throw new NotImplementedException("Chua khai bao Database Node cho " + contextType.Name);
        }
    }


    public enum DatabaseNode
    {
        Default = 0,
        BOReadOnly = 1,
        FOReadOnly = 2
    }
}
